﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;

public partial class AddMurderDetail : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        con.ConnectionString = ConfigurationManager.ConnectionStrings["PAS_DB"].ConnectionString;
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = con;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "AddMurderDetails";
        cmd.Parameters.AddWithValue("@FIRNo", TextBox13.Text.Trim());
        cmd.Parameters.AddWithValue("@VictimName", TextBox4.Text.Trim());
        cmd.Parameters.AddWithValue("@Address", TextBox6.Text.Trim());
        cmd.Parameters.AddWithValue("@Age", TextBox17.Text.Trim());
        cmd.Parameters.AddWithValue("@Gender", RadioButtonList1.SelectedValue.ToString());
        cmd.Parameters.AddWithValue("@Relation",TextBox12.Text.Trim());
        cmd.Parameters.AddWithValue("@MDate", DropDownList2.SelectedValue.ToString()+DropDownList3.SelectedValue.ToString()+DropDownList4.SelectedValue.ToString());
        cmd.Parameters.AddWithValue("@Remark", TextBox17.Text.Trim());
        cmd.Connection = con;
        try
        {
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
            Label23.Text = "Record Inserted";
        }
        catch (SqlException ex)
        {
            Label23.Text = ex.Message;
        }
    }
}
